Post

Replies

Boosts

Views

Activity

Reply to Does code at 04:41 compile?
I wish Apple would test their code before presenting at a conference. I added a name state variable for the TextField. @State private var name: String = "" ... .sheet(item: $donutToAdd) { _ in TextField("Name", text: $name) .padding(10) .overlay( RoundedRectangle(cornerRadius: 20) .stroke(Color.black) ) Button("Save") { if let donutToAdd { donutToAdd.name = name donutList.donuts.append(donutToAdd ) self.donutToAdd = nil self.name = "" } } Button("Cancel") { self.donutToAdd = nil } } code-block And DonutList needs to be a class (else you get a mutating member on immutable value). @Observable class DonutList { var donuts: [Donut] init(donuts: [Donut]) { self.donuts = donuts } } code-block
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’24
Reply to Using camera with Mac Catalyst
Cool
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’22
Reply to How to fix "There was a problem with your request." in Cloudkit console?
"Reset Development Environment" will delete ALL your Records and your Custom Zones. Did you add an index to your RecordType using the console? "Add Basic Index" > make "recordName" QUERYABLE. The reset will delete your indexes
Replies
Boosts
Views
Activity
Aug ’22
Reply to Does code at 04:41 compile?
I wish Apple would test their code before presenting at a conference. I added a name state variable for the TextField. @State private var name: String = "" ... .sheet(item: $donutToAdd) { _ in TextField("Name", text: $name) .padding(10) .overlay( RoundedRectangle(cornerRadius: 20) .stroke(Color.black) ) Button("Save") { if let donutToAdd { donutToAdd.name = name donutList.donuts.append(donutToAdd ) self.donutToAdd = nil self.name = "" } } Button("Cancel") { self.donutToAdd = nil } } code-block And DonutList needs to be a class (else you get a mutating member on immutable value). @Observable class DonutList { var donuts: [Donut] init(donuts: [Donut]) { self.donuts = donuts } } code-block
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’24
Reply to Access Unavailable : IOS Certificates
Signing Certificate access was blocked a day before License expired.
Replies
Boosts
Views
Activity
Oct ’24
Reply to iOS 16.0 beta 7 broke Text(Date(), style: .timer) in SwiftUI widgets
Still broken in Widget PREVIEW (Xcode 16.4), but works in SIMULATOR (iphone 16 on 18.5).
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Jul ’25